@model IEnumerable<Reviews>

@{
    var ModelName = "Reviews";
    ViewData["Title"] = ModelName;
}

<h2>@ModelName</h2>

@if (Model.Count() <= 0)
{
    <h3>You haven't created any @ModelName yet...</h3>
}

<p>
    <a asp-action="Create" class="btn btn-success">Create New</a>
</p>
<table class="table">
    <thead>
        <tr>
                <th>
                    @Html.DisplayNameFor(model => model.Title)
                </th>
                <th>
                    @Html.DisplayNameFor(model => model.Description)
                </th>
                <th>
                    @Html.DisplayNameFor(model => model.Grade)
                </th>
                <th>
                    @Html.DisplayNameFor(model => model.Date)
                </th>
            <th>
                @Html.DisplayNameFor(model => model.Pizza)
            </th>
            <th>
                @Html.DisplayNameFor(model => model.User)
            </th>
            <th></th>
        </tr>
    </thead>
    <tbody>
@foreach (var item in Model) {
        <tr>
            <td>
                @Html.DisplayFor(modelItem => item.Title)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.Description)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.Grade)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.Date)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.Pizza.Name)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.User.Email)
            </td>
            <td>
                <a asp-action="Edit" asp-route-id="@item.Id">Edit</a> |
                <a asp-action="Details" asp-route-id="@item.Id">Details</a> |
                <a asp-action="Delete" asp-route-id="@item.Id">Delete</a>
            </td>
        </tr>
}
    </tbody>
</table>
